home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 07511000 / var0888.dms / var0888.adf / WoManD / man / C_Library / atoi < prev    next >
Text File  |  1992-09-19  |  2KB  |  53 lines

  1. ATOI(1)                     C LIBRARY FUNCTIONS                      ATOI(1)
  2.  
  3. NAME
  4.      strtol, strtoul, atol, atoi - convert string to integer
  5.  
  6. SYNOPSIS
  7.      long strtol(const char *str, char **end_ptr, int base);
  8.  
  9.      unsigned long strtoul(const char *str, char **end_ptr, int base);
  10.  
  11.      long atol(char *str);
  12.  
  13.      int atoi(char *str);
  14.  
  15. INCLUDE FILE
  16.      stdlib.h
  17.  
  18. DESCRIPTION
  19.      strtol() returns as a long integer the value represented by the
  20.            character string pointed to by str. The string is scanned up to
  21.            the first character inconsistent with the base. Leading
  22.            ``white-space'' characters.
  23.  
  24.            If the value of end_ptr is not (char **)NULL, a pointer to the
  25.            character terminating the scan is returned in the location pointed
  26.            to by end_ptr. If no integer can be formed, that location is set
  27.            to str, and zero is returned.
  28.  
  29.            If base is positive (and not greater than 36), it is used as the
  30.            base for conversion. After an optional leading sign, leading zeros
  31.            are ignored, and ``0x'' or ``0X'' is ignored if base is 16. The
  32.            letters a through z and A through Z are interpreted as 10 to 35
  33.            respectively. With a smaller base, only the digits and letters
  34.            with corresponding values less than the base are interpreted.
  35.  
  36.            If base is zero, the string itself determines the base thus,
  37.            after an  optional leading sign a leading zero indicates octal
  38.            conversion, and a leading "0x" or "0X" hexadecimal conversion.
  39.            Otherwise, decimal conversion is used.
  40.  
  41.            Truncation from long to int can, of course, take place upon
  42.            assignment or by an explicit cast.
  43.  
  44.      strtoul() is similar to strtoul(), but return an unsigned long. On
  45.            overflow, either ULONG_MAX or -ULONG_MAX is returned.
  46.  
  47.      atol(str) is equivalent to strtol(str, NULL, 10).
  48.  
  49.      atoi(str) is equivalent to (int) strtol(str, NULL, 10).
  50.  
  51. SEE ALSO
  52.      scanf(), strtod(), atof().
  53.